/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Dao;

import Util.MySqlDataAccessHelper;
import Pojo.NhaXuatBan;
import java.sql.ResultSet;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author USER
 */
public class NhaXuatBanDAO {

    //lấy danh sách nhà xuất bản.
    public static List<NhaXuatBan> layNhaXuatBan(String mySQL) {
        ArrayList<NhaXuatBan> kq = new ArrayList<NhaXuatBan>();

        try {            
            MySqlDataAccessHelper helper = new MySqlDataAccessHelper();
            helper.open();
            ResultSet rs = helper.executeQuery(mySQL);
            while (rs.next()) {
                NhaXuatBan nxb = new NhaXuatBan();
                nxb.setMaNXB(rs.getInt("ma_nha_xuat_ban"));
                nxb.setTenNXB(rs.getString("ten_nha_xuat_ban"));
                kq.add(nxb);
            }
            helper.close();
            return kq;

        } catch (Exception e) {
            return null;
        }



    }
}
